import requests
import json
import time
KEY = 'ASKJHASFBNWFP；asdf'
import hashlib
# r1 = requests.post(
# 	url='http://127.0.0.1:8000/test/',
# 	# params={'key':KEY},
# 	data=json.dumps({'k1': 'v1'}).encode('utf-8'),
# 	headers={'Content-Type': 'application/json'}
# )
#
# print(r1.text)


ctime = time.time()
def gen_key():
	key = "{}|{}".format(KEY,ctime)

	md5 = hashlib.md5()
	md5.update(key.encode('utf-8'))

	return md5.hexdigest()

key = gen_key()
print(key)

r1 = requests.post(
	url='http://127.0.0.1:8000/test/',
	params={'key':key,'ctime':ctime},
	data=json.dumps({'k1': 'v1'}).encode('utf-8'),
	headers={'Content-Type': 'application/json'}
)

print(r1.text)